home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.2 Development Libraries / SGI IRIX 6.2 Development Libraries.iso / dist / complib.idb / usr / share / catman / p_man / cat3 / complib / ztgsja.z / ztgsja
Text File  |  1996-03-14  |  11KB  |  331 lines

  1.  
  2.  
  3.  
  4. ZZZZTTTTGGGGSSSSJJJJAAAA((((3333FFFF))))                                                          ZZZZTTTTGGGGSSSSJJJJAAAA((((3333FFFF))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      ZTGSJA - compute the generalized singular value decomposition (GSVD) of
  10.      two complex upper triangular (or trapezoidal) matrices A and B
  11.  
  12. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  13.      SUBROUTINE ZTGSJA( JOBU, JOBV, JOBQ, M, P, N, K, L, A, LDA, B, LDB, TOLA,
  14.                         TOLB, ALPHA, BETA, U, LDU, V, LDV, Q, LDQ, WORK,
  15.                         NCYCLE, INFO )
  16.  
  17.          CHARACTER      JOBQ, JOBU, JOBV
  18.  
  19.          INTEGER        INFO, K, L, LDA, LDB, LDQ, LDU, LDV, M, N, NCYCLE, P
  20.  
  21.          DOUBLE         PRECISION TOLA, TOLB
  22.  
  23.          DOUBLE         PRECISION ALPHA( * ), BETA( * )
  24.  
  25.          COMPLEX*16     A( LDA, * ), B( LDB, * ), Q( LDQ, * ), U( LDU, * ), V(
  26.                         LDV, * ), WORK( * )
  27.  
  28. PPPPUUUURRRRPPPPOOOOSSSSEEEE
  29.      ZTGSJA computes the generalized singular value decomposition (GSVD) of
  30.      two complex upper triangular (or trapezoidal) matrices A and B.
  31.  
  32.      On entry, it is assumed that matrices A and B have the following forms,
  33.      which may be obtained by the preprocessing subroutine ZGGSVP from a
  34.      general M-by-N matrix A and P-by-N matrix B:
  35.  
  36.                   N-K-L  K    L
  37.         A =    K ( 0    A12  A13 ) if M-K-L >= 0;
  38.                L ( 0     0   A23 )
  39.            M-K-L ( 0     0    0  )
  40.  
  41.                 N-K-L  K    L
  42.         A =  K ( 0    A12  A13 ) if M-K-L < 0;
  43.            M-K ( 0     0   A23 )
  44.  
  45.                 N-K-L  K    L
  46.         B =  L ( 0     0   B13 )
  47.            P-L ( 0     0    0  )
  48.  
  49.      where the K-by-K matrix A12 and L-by-L matrix B13 are nonsingular upper
  50.      triangular; A23 is L-by-L upper triangular if M-K-L >= 0, otherwise A23
  51.      is (M-K)-by-L upper trapezoidal.
  52.  
  53.      On exit,
  54.  
  55.             U'*A*Q = D1*( 0 R ),    V'*B*Q = D2*( 0 R ),
  56.  
  57.      where U, V and Q are unitary matrices, Z' denotes the conjugate transpose
  58.      of Z, R is a nonsingular upper triangular matrix, and D1 and D2 are
  59.      ``diagonal'' matrices, which are of the following structures:
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. ZZZZTTTTGGGGSSSSJJJJAAAA((((3333FFFF))))                                                          ZZZZTTTTGGGGSSSSJJJJAAAA((((3333FFFF))))
  71.  
  72.  
  73.  
  74.      If M-K-L >= 0,
  75.  
  76.                          K  L
  77.             D1 =     K ( I  0 )
  78.                      L ( 0  C )
  79.                  M-K-L ( 0  0 )
  80.  
  81.                         K  L
  82.             D2 = L   ( 0  S )
  83.                  P-L ( 0  0 )
  84.  
  85.                     N-K-L  K    L
  86.        ( 0 R ) = K (  0   R11  R12 ) K
  87.                  L (  0    0   R22 ) L
  88.  
  89.      where
  90.  
  91.        C = diag( ALPHA(K+1), ... , ALPHA(K+L) ),
  92.        S = diag( BETA(K+1),  ... , BETA(K+L) ),
  93.        C**2 + S**2 = I.
  94.  
  95.        R is stored in A(1:K+L,N-K-L+1:N) on exit.
  96.  
  97.      If M-K-L < 0,
  98.  
  99.                     K M-K K+L-M
  100.          D1 =   K ( I  0    0   )
  101.               M-K ( 0  C    0   )
  102.  
  103.                       K M-K K+L-M
  104.          D2 =   M-K ( 0  S    0   )
  105.               K+L-M ( 0  0    I   )
  106.                 P-L ( 0  0    0   )
  107.  
  108.                     N-K-L  K   M-K  K+L-M
  109.  
  110.                M-K ( 0     0   R22  R23  )
  111.              K+L-M ( 0     0    0   R33  )
  112.  
  113.      where
  114.      C = diag( ALPHA(K+1), ... , ALPHA(M) ),
  115.      S = diag( BETA(K+1),  ... , BETA(M) ),
  116.      C**2 + S**2 = I.
  117.  
  118.      R = ( R11 R12 R13 ) is stored in A(1:M, N-K-L+1:N) and R33 is stored
  119.          (  0  R22 R23 )
  120.      in B(M-K+1:L,N+M-K-L+1:N) on exit.
  121.  
  122.      The computation of the unitary transformation matrices U, V or Q is
  123.      optional.  These matrices may either be formed explicitly, or they may be
  124.      postmultiplied into input matrices U1, V1, or Q1.
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. ZZZZTTTTGGGGSSSSJJJJAAAA((((3333FFFF))))                                                          ZZZZTTTTGGGGSSSSJJJJAAAA((((3333FFFF))))
  137.  
  138.  
  139.  
  140. AAAARRRRGGGGUUUUMMMMEEEENNNNTTTTSSSS
  141.      JOBU    (input) CHARACTER*1
  142.              = 'U':  U must contain a unitary matrix U1 on entry, and the
  143.              product U1*U is returned; = 'I':  U is initialized to the unit
  144.              matrix, and the unitary matrix U is returned; = 'N':  U is not
  145.              computed.
  146.  
  147.      JOBV    (input) CHARACTER*1
  148.              = 'V':  V must contain a unitary matrix V1 on entry, and the
  149.              product V1*V is returned; = 'I':  V is initialized to the unit
  150.              matrix, and the unitary matrix V is returned; = 'N':  V is not
  151.              computed.
  152.  
  153.      JOBQ    (input) CHARACTER*1
  154.              = 'Q':  Q must contain a unitary matrix Q1 on entry, and the
  155.              product Q1*Q is returned; = 'I':  Q is initialized to the unit
  156.              matrix, and the unitary matrix Q is returned; = 'N':  Q is not
  157.              computed.
  158.  
  159.      M       (input) INTEGER
  160.              The number of rows of the matrix A.  M >= 0.
  161.  
  162.      P       (input) INTEGER
  163.              The number of rows of the matrix B.  P >= 0.
  164.  
  165.      N       (input) INTEGER
  166.              The number of columns of the matrices A and B.  N >= 0.
  167.  
  168.      K       (input) INTEGER
  169.              L       (input) INTEGER K and L specify the subblocks in the
  170.              input matrices A and B:
  171.              A23 = A(K+1:MIN(K+L,M),N-L+1:N) and B13 = B(1:L,,N-L+1:N) of A
  172.              and B, whose GSVD is going to be computed by ZTGSJA.  See Further
  173.              details.
  174.  
  175.      A       (input/output) COMPLEX*16 array, dimension (LDA,N)
  176.              On entry, the M-by-N matrix A.  On exit, A(N-K+1:N,1:MIN(K+L,M) )
  177.              contains the triangular matrix R or part of R.  See Purpose for
  178.              details.
  179.  
  180.      LDA     (input) INTEGER
  181.              The leading dimension of the array A. LDA >= max(1,M).
  182.  
  183.      B       (input/output) COMPLEX*16 array, dimension (LDB,N)
  184.              On entry, the P-by-N matrix B.  On exit, if necessary, B(M-
  185.              K+1:L,N+M-K-L+1:N) contains a part of R.  See Purpose for
  186.              details.
  187.  
  188.      LDB     (input) INTEGER
  189.              The leading dimension of the array B. LDB >= max(1,P).
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. ZZZZTTTTGGGGSSSSJJJJAAAA((((3333FFFF))))                                                          ZZZZTTTTGGGGSSSSJJJJAAAA((((3333FFFF))))
  203.  
  204.  
  205.  
  206.      TOLA    (input) DOUBLE PRECISION
  207.              TOLB    (input) DOUBLE PRECISION TOLA and TOLB are the
  208.              convergence criteria for the Jacobi- Kogbetliantz iteration
  209.              procedure. Generally, they are the same as used in the
  210.              preprocessing step, say TOLA = MAX(M,N)*norm(A)*MAZHEPS, TOLB =
  211.              MAX(P,N)*norm(B)*MAZHEPS.
  212.  
  213.      ALPHA   (output) DOUBLE PRECISION array, dimension (N)
  214.              BETA    (output) DOUBLE PRECISION array, dimension (N) On exit,
  215.              ALPHA and BETA contain the generalized singular value pairs of A
  216.              and B; ALPHA(1:K) = 1,
  217.              BETA(1:K)  = 0, and if M-K-L >= 0, ALPHA(K+1:K+L) = diag(C),
  218.              BETA(K+1:K+L)  = diag(S), or if M-K-L < 0, ALPHA(K+1:M)= C,
  219.              ALPHA(M+1:K+L)= 0
  220.              BETA(K+1:M) = S, BETA(M+1:K+L) = 1.  Furthermore, if K+L < N,
  221.              ALPHA(K+L+1:N) = 0
  222.              BETA(K+L+1:N)  = 0.
  223.  
  224.      U       (input/output) COMPLEX*16 array, dimension (LDU,M)
  225.              On entry, if JOBU = 'U', U must contain a matrix U1 (usually the
  226.              unitary matrix returned by ZGGSVP).  On exit, if JOBU = 'I', U
  227.              contains the unitary matrix U; if JOBU = 'U', U contains the
  228.              product U1*U.  If JOBU = 'N', U is not referenced.
  229.  
  230.      LDU     (input) INTEGER
  231.              The leading dimension of the array U. LDU >= max(1,M) if JOBU =
  232.              'U'; LDU >= 1 otherwise.
  233.  
  234.      V       (input/output) COMPLEX*16 array, dimension (LDV,P)
  235.              On entry, if JOBV = 'V', V must contain a matrix V1 (usually the
  236.              unitary matrix returned by ZGGSVP).  On exit, if JOBV = 'I', V
  237.              contains the unitary matrix V; if JOBV = 'V', V contains the
  238.              product V1*V.  If JOBV = 'N', V is not referenced.
  239.  
  240.      LDV     (input) INTEGER
  241.              The leading dimension of the array V. LDV >= max(1,P) if JOBV =
  242.              'V'; LDV >= 1 otherwise.
  243.  
  244.      Q       (input/output) COMPLEX*16 array, dimension (LDQ,N)
  245.              On entry, if JOBQ = 'Q', Q must contain a matrix Q1 (usually the
  246.              unitary matrix returned by ZGGSVP).  On exit, if JOBQ = 'I', Q
  247.              contains the unitary matrix Q; if JOBQ = 'Q', Q contains the
  248.              product Q1*Q.  If JOBQ = 'N', Q is not referenced.
  249.  
  250.      LDQ     (input) INTEGER
  251.              The leading dimension of the array Q. LDQ >= max(1,N) if JOBQ =
  252.              'Q'; LDQ >= 1 otherwise.
  253.  
  254.      WORK    (workspace) COMPLEX*16 array, dimension (2*N)
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. ZZZZTTTTGGGGSSSSJJJJAAAA((((3333FFFF))))                                                          ZZZZTTTTGGGGSSSSJJJJAAAA((((3333FFFF))))
  269.  
  270.  
  271.  
  272.      NCYCLE  (output) INTEGER
  273.              The number of cycles required for convergence.
  274.  
  275.      INFO    (output) INTEGER
  276.              = 0:  successful exit
  277.              < 0:  if INFO = -i, the i-th argument had an illegal value.
  278.              = 1:  the procedure does not converge after MAXIT cycles.
  279.  
  280. PPPPAAAARRRRAAAAMMMMEEEETTTTEEEERRRRSSSS
  281.      MAXIT   INTEGER
  282.              MAXIT specifies the total loops that the iterative procedure may
  283.              take. If after MAXIT cycles, the routine fails to converge, we
  284.              return INFO = 1.
  285.  
  286.              Further Details ===============
  287.  
  288.              ZTGSJA essentially uses a variant of Kogbetliantz algorithm to
  289.              reduce min(L,M-K)-by-L triangular (or trapezoidal) matrix A23 and
  290.              L-by-L matrix B13 to the form:
  291.  
  292.              U1'*A13*Q1 = C1*R1; V1'*B13*Q1 = S1*R1,
  293.  
  294.              where U1, V1 and Q1 are unitary matrix, and Z' is the conjugate
  295.              transpose of Z.  C1 and S1 are diagonal matrices satisfying
  296.  
  297.              C1**2 + S1**2 = I,
  298.  
  299.              and R1 is an L-by-L nonsingular upper triangular matrix.
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.                                                                         PPPPaaaaggggeeee 5555
  328.  
  329.  
  330.  
  331.